package com.xxy.crm.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xxy.crm.base.BaseService;
import com.xxy.crm.dao.CustomerOrderDetailsMapper;
import com.xxy.crm.query.CustomerOrderDetailQuery;
import com.xxy.crm.vo.CustomerOrderDetails;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public class CustomerOrderDetailsService extends BaseService<CustomerOrderDetails,Integer> {
    @Resource
    private CustomerOrderDetailsMapper customerOrderDetailsMapper;

    public Map<String, Object> queryCustomerOrderDetail(CustomerOrderDetailQuery customerOrderDetailQuery) {
        Map<String,Object> map = new HashMap<>();
        PageHelper.startPage(customerOrderDetailQuery.getPage(), customerOrderDetailQuery.getLimit());
        PageInfo<CustomerOrderDetails> pageInfo = new PageInfo<>(customerOrderDetailsMapper.queryCustomerOrderDetail(customerOrderDetailQuery));
        map.put("code",0);
        map.put("msg","success");
        map.put("count",pageInfo.getTotal());
        map.put("data",pageInfo.getList());
        return map;
    }
}
